﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using ZLDC.Common.BaseUser;
using System.Data.SqlClient;


namespace ZLDC.Common
{
    public class C_CreateNumber
    {
        public C_CreateNumber()
        {
        }
        public static string sNumber(string sTable, string sField)
        {
            string sN = "";
            DataTable dt;

            SqlParameter[] arrPara = new SqlParameter[2];
            arrPara[0] = new SqlParameter("@Table", SqlDbType.NVarChar, 100);
            arrPara[0].Value = sTable;

            arrPara[1] = new SqlParameter("@Field", SqlDbType.NVarChar, 100);
            arrPara[1].Value = sField;

            DataBase db = new DataBase();
            dt = db.ExecuteProcDs("p_Number", arrPara).Tables[0];

            if (dt.Rows.Count > 0)
            {
                sN = dt.Rows[0][0].ToString();
            }
            return sN;
        }

        public static string sBookingNumber()
        {
            string sN = "";

            sN = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            sN = sN.Replace("-", "").Replace(" ", "").Replace(":", "");
            sN = sN.Substring(2, sN.Length - 2);
            return sN;
        }
        public static string sLClSoNumber()
        {

            string sN = "";
            sN = DateTime.Now.ToString("yyyy-MM-dd");
            sN = sN.Replace("-", "").Replace(" ", "");
            sN = sN.Substring(2, sN.Length - 4);
            return sN;
        }
    }
}
